import request from '@/utils/request'

// 查询用户信息表分页列表
export function listSysUser(page) {
    return request({
        url: '/api-system/sysUser/list',
        method: 'post',
        data: page
    })
}

// 查询用户信息表详细
export function infoSysUser(sysUserId) {
    return request({
        url: '/api-system/sysUser/info/' + sysUserId,
        method: 'get'
    })
}


// 新增用户信息表
export function addSysUser(data) {
    return request({
        url: '/api-system/sysUser/add',
        method: 'post',
        data: data
    })
}

// 修改用户信息表
export function editSysUser(data) {
  console.log(data);
    return request({
        url: '/api-system/sysUser/edit',
        method: 'post',
        data: data
    })
}

// 删除用户信息表
export function removeSysUser(sysUserId) {
    return request({
        url: '/api-system/sysUser/remove/' + sysUserId,
        method: 'post'
    })
}

// 用户角色
export function updateUserRole(sysUserRole) {
    return request({
        url: '/api-system/sysUser/updateUserRole' ,
        method: 'post',
        data:sysUserRole
    })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/api-system/sysUser/profile/info',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/api-system/sysUser/profile/edit',
    method: 'post',
    data: data
  })
}

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/api-system/sysUser/profile/updatePwd',
    method: 'post',
    params: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/api-system/sysUser/profile/avatar',
    method: 'post',
    data: data
  })
}
